<?php ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Amazing聯播網</title>
	 <!-- 
	<script type="text/javascript" src="/ad/html/js/ext/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="/ad/html/js/ext/ext-all.js"></script>
	-->
	<script type="text/javascript" src="/ad/html/js/util.js"></script> 
	
	<head>
		
	</head>
	<body>
		<div id="display"></div>
		
		<script type="text/javascript">
	   
		Ext.Ajax.request({
			url : "http://mmedia.ai-ad.net.tw/ad/sys/com/control/AdService.php?action=queryAd&md5key=<?php echo $_GET["md5key"]?>&IMEI=<?php echo $_GET["IMEI"]?>",			
			callback  : function (op, su, rsp) {
			   
	           var json =  Ext.util.JSON.decode(decodeURI(rsp.responseText)).item;
			   var data =  null;
			   if (json.length ==0) {
				 return;
			   } 	

			   var data =  json[0];
			   var w = 0;
			   var h = 0;
			   var url  = data.Image1 != null && data.Image1 !='' ? data.Image1 : data.Image2;


			   if (data.Image1 != null && data.Image1 !='') {
				   url =  data.Image1;
				   h = 80;
				   w = 480;
			   } else {
				   url =  data.Image2;
				   h = 50;
				   w = 320;	
		       }
			   
               var img =  "<img src='http://mmedia.ai-ad.net.tw/" + url+ "' title='"+data.Title+"' width="+w+" height="+h+"></img>";  
 
               Ext.getDom("display").innerHTML =  img;
			}
		}); 


		/* 
		{"item":[{"Id":"78","Account":"yyy@yyy.yyy","Url":"http:\/\/www.yahoo.com.tw","Title":"\u5657\u5657\u5657\u5657\u5657\u5657\u5657\u5657\u5657\u5657","Image1":"\/ad\/upload\/ad\/banner02.jpg","Image2":"\/ad\/upload\/ad\/tiago.jpg","Area":"DK,","AreaName":"\u4e39\u9ea5,","AgeStart":"0","AgeEnd":"99","Sex":"0","AdName":"\u5657\u5657\u5657","AdBudgetType":"1","AdStartDate":"2011-10-31","AdEndDate":"2012-02-29","AdBillingType":"CPC","ClickAction":"0","CreateTime":"2011-10-28 14:40:21","Status":"1","IsPay":"0","IsNew":"0","Lifetime":null,"ClickCount":"0","UrlParam":"","Budget":"600","Overage":"0","Outlay":"0","EstimateImpressions":"0","ActualImpressions":"1463","ImpressionsRate":null,"EstimateClick":"0","ActuaClick":"66","ClickRate":null,"CPC":"0","CPM":"0","Description":"\u4f60\u5df2\u7d93\u901a\u904e\u4e86\u54e6","CPMPublish":null,"CPCPublish":null}],"appInfo":{"name":"1","id":"13","adcategorId":"1","description":"1","appType":"1","testAction":"1","account":"zzz@zzz.zzz","createTime":"2011-10-28 11:14:35","ModifyTime":"2011-10-28 11:14:35","startTime":"2011-11-02 10:51:24","md5key":"dbf5e2b9eefdeda5d998ab21638c1749","status":"4"}}

		
		*/	
			
		 //http://mmedia.ai-ad.net.tw/ad/sys/com/control/AdService.php?action=queryAd&md5key=dbf5e2b9eefdeda5d998ab21638c1749&IMEI=1
		
		</script>
		
	</body>
</html>